package asionreachel.cn.smarthomedemo.base;

import android.content.Context;
import android.support.v7.widget.RecyclerView;

import java.util.ArrayList;

/**
 * Created by Simon(lyd) on 2016/9/29 09:55.
 * 描述：
 */

public abstract class BaseAdapter<T extends RecyclerView.ViewHolder,E> extends RecyclerView.Adapter{

    public Context context;

    private ArrayList<E> listDatas;

    public BaseAdapter(Context context){
        this.context = context;
    }

    public void setAdapterDatas(ArrayList<E> listDatas) {
        this.listDatas = listDatas;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        onMyBindViewHolder((T) holder,position);
    }

    public abstract void onMyBindViewHolder(T holder, int position);

    @Override
    public int getItemCount() {
        return listDatas == null?0:listDatas.size();
    }
}
